<?php

/**
 * Created by PhpStorm.
 * User: ford
 * Date: 15-7-8
 * Time: 下午4:42
 */
class Walk {
	private $optionKeys = array(
		'ownADog', 'tired', 'haveNotWalkedForDays', 'niceOutside', 'bored');
	private $options = array();

	public function __construct() {
		foreach ($this->optionKeys as $key) {
			$this->options[$key] = true;
		}
	}

	public function move() {
		if ($this->shouldWalk()) {
			$this->goForAWalk();
		}
	}

	public function shouldWalk() {
		return ($this->timeToWalkTheDog() || $this->feelLikeWalking());
	}

	public function timeToWalkTheDog() {
		return ($this->options['ownADog'] && (!$this->options['tired'] || $this->options['haveNotWalkedForDays']));
	}

	public function feelLikeWalking() {
		return (($this->options['niceOutside'] && !$this->options['tired']) || $this->options['bored']);
	}

	public function __set($name, $value) {
		if (in_array($name, $this->optionKeys)) {
			$this->options[$name] = $value;
		}
	}

	private function goForAWalk() {
		echo "Going for a walk";
	}

}